package com.edu.service;

import com.edu.bean.Feedback;
import com.edu.dao.FeedbackDao;

import java.util.List;
import java.util.Map;

public class UserFeedbackService {
    private FeedbackDao feedbackDao = new FeedbackDao();

    /**
     * 分页获取反馈列表
     */
    public List<Feedback> userGetFeedbackList(int page, int pageSize) {
        int start = (page - 1) * pageSize;
        return feedbackDao.userFindByPage(start, pageSize);
    }

    /**
     * 获取反馈总数
     */
    public int userGetFeedbackTotalCount() {
        return feedbackDao.userFindTotalCount();
    }

    /**
     * 添加反馈
     */
    public boolean userAddFeedback(Integer userId, String title, String content) {
        Feedback feedback = new Feedback();
        feedback.setUserId(userId);
        feedback.setTitle(title);
        feedback.setContent(content);
        return feedbackDao.userAddFeedback(feedback);
    }
}